
#@layout()
#define css()
#@layout_css?()
<link rel="stylesheet" href="#(CPATH)/static/components/datepicker/css/bootstrap-datepicker3.min.css">
#end
#define script()
#@layout_script?()
<script src="#(CPATH)/static/components/datepicker/js/bootstrap-datepicker.min.js"></script>
<script src="#(CPATH)/static/components/datepicker/locales/bootstrap-datepicker.zh-CN.min.js"></script>
<script>
    $("input[hint='date']").datepicker({
        format: 'yyyy-mm-dd',
        language: 'zh-CN'
    });

  function doSubmit() {
    ajaxSubmit("#form", function (data) {
        $("#entryId").attr("value", data.id);
        toastr.success('内容保存成功。');
    })
  }

    $("#submit").on("click", function () {
        doSubmit();
    })

	$('#getLinkInfs').click(function () {
		$.post("/admin/LinkManage/jpress_addon_link_list/getICO",{"url":$('#url').val()},function (data) {
            $('#icon').val(data.icon);
            $('#desc').val(data.description);
            $('#title').val(data.title);
            toastr.success('获取成功。');
		})
	})
    </script>
#end


#define content()
<div class="content-wrapper">

    <section class="content-header">
        <h1>
                        编辑/新增
            <small>Edit</small>
        </h1>
    </section>

    <section class="content">

        <div class="row">
            <div class="col-xs-12">
                <div class="box box-primary">
                    <div class="box-header ">
                        <h3 class="box-title"></h3>
                    </div>
                    <form class="form-horizontal form-setting" autocomplete="off"
                          action="/admin/LinkManage/jpress_addon_link_list/doSave"
                          method="POST" id="form">

                        <div class="box-body ">
	                                <input type="hidden" id="entryId" name="jpressAddonLinkList.id" value="#(jpressAddonLinkList.id ??)">
                            填写网址后可以使用一键获取工具获取该网站信息，如果没获取到，请手动添加
							<div class="form-group">
								<label class="col-sm-2 control-label">网址 <span style="color: red;">*</span></label>
								<div class="col-sm-6">
									<input type="input" id="url" name="jpressAddonLinkList.url" class="form-control" value="#(jpressAddonLinkList.url ??)"
										   placeholder="">
                                    <label class="col-sm-4 control-label">
                                        <input id="getLinkInfs" class="btn" value="一键获取网站信息"/>
                                    </label>
                                </div>
							</div>
							<div class="form-group">
		                                <label class="col-sm-2 control-label">网站标题 <span style="color: red;">*</span></label>
		                                <div class="col-sm-6">

										   <input id="title" type="input" name="jpressAddonLinkList.title" class="form-control" value="#(jpressAddonLinkList.title ??)"
		                                           placeholder="">
		                                </div>
		                            </div>
		                            <div class="form-group">
		                                <label class="col-sm-2 control-label">网站描述</label>
		                                <div class="col-sm-6">

										   <input id="desc" type="input" name="jpressAddonLinkList.description" class="form-control" value="#(jpressAddonLinkList.description ??)"
		                                           placeholder="">
		                                </div>
		                            </div>
		                            <div class="form-group">
		                                <label class="col-sm-2 control-label">网站LOGO</label>
		                                <div class="col-sm-6">

										   <input id="icon" type="input" name="jpressAddonLinkList.logo" class="form-control" value="#(jpressAddonLinkList.logo ??)"
		                                           placeholder="">
		                                </div>
		                            </div>
		                            <div class="form-group">
		                                <label class="col-sm-2 control-label">网站分类 <span style="color: red;">*</span></label>
		                                <div class="col-sm-6">
											<select class="form-control" name="jpressAddonLinkList.type">
												#LinkManagesTypeAll()
													#for(linkType : LinkTypes)
														<option #(linkType.id == jpressAddonLinkList.type ?? ? selected="selected" : class="" ) value="#(linkType.id)">#(linkType.name)</option>
													#end
												#end
											</select>
<!--										   <input type="input" name="jpressAddonLinkList.type" class="form-control" value="#(jpressAddonLinkList.type ??)"-->
<!--		                                           placeholder="">-->
		                                </div>
		                            </div>
		                            <div class="form-group">
		                                <label class="col-sm-2 control-label">添加时间 <span style="color: red;">*</span></label>
		                                <div class="col-sm-6">

										    <input type="input" class="form-control datetimepicker" placeholder="点击选择"
		                       						name="jpressAddonLinkList.time" value="#date(jpressAddonLinkList.time ?? now,'yyyy-MM-dd')" >
		                                </div>
		                            </div>
		                            <div class="form-group">
		                                <label class="col-sm-2 control-label">称呼</label>
		                                <div class="col-sm-6">

										   <input type="input" name="jpressAddonLinkList.name" class="form-control" value="#(jpressAddonLinkList.name ??)"
		                                           placeholder="">
		                                </div>
		                            </div>
		                            <div class="form-group">
		                                <label class="col-sm-2 control-label">联系邮箱</label>
		                                <div class="col-sm-6">

										   <input type="input" name="jpressAddonLinkList.email" class="form-control" value="#(jpressAddonLinkList.email ??)"
		                                           placeholder="">
		                                </div>
		                            </div>
		                            <div class="form-group">
		                                <label class="col-sm-2 control-label">网站状态 <span style="color: red;">*</span></label>
		                                <div class="col-sm-6">
											<select  name="jpressAddonLinkList.state" class="form-control" >
												<option #(jpressAddonLinkList.state ?? == 1 ? selected : class="" ) value="1">通过</option>
												<option #(jpressAddonLinkList.state ?? == 2 ? selected : class="" ) value="2">失效</option>
												<option #(jpressAddonLinkList.state ?? == 3 ? selected : class="" ) value="3">待审核</option>
											</select>
		                                </div>
		                            </div>
		                            <div class="form-group">
		                                <label class="col-sm-2 control-label">备注</label>
		                                <div class="col-sm-6">

										   <input type="input" name="jpressAddonLinkList.remark" class="form-control" value="#(jpressAddonLinkList.remark ??)"
		                                           placeholder="">
		                                </div>
		                            </div>

                        </div>
                        <!-- /.box-body -->
                        <div class="box-footer">
                            <div class="col-sm-offset-2 col-sm-10 submit-block">
                                <div class="box-submit">
                                    <button id="submit" type="button" class="btn btn-primary">提交</button>
                                </div>
                            </div>
                        </div>
                        <!-- /.box-footer -->
                    </form>
                </div>
            </div>
        </div>

    </section>

</div>
#end